package com.cheng.example.atguigu.view2.client04;


class MyData {
    int number = 0;

    public void addTO60() {
        this.number = 60;
    }
}

public class Test {

    public static volatile int i = 1;

    public static void main(String[] args) {

        MyData myData = new MyData();
        new Thread(() -> {
            System.out.println(Thread.currentThread().getName() + "\t come in");
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            myData.addTO60();

        }, "AAA").start();

        while (myData.number != 60) {
            i = i++;
        }

        System.out.println(Thread.currentThread().getName() + "\t mission is over");
    }

}


